package cn.dmrliu.edu.publish.mapper;

import cn.dmrliu.edu.publish.bean.InteractionReview;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface InteractionReviewMapper {

    @Select("select\n" +
            "  course_id,\n" +
            "  course_name,\n" +
            "  sum(dws_interaction_review_window.review_start*dws_interaction_review_window.user_ct)/sum(dws_interaction_review_window.user_ct) avg_score,\n" +
            "  sum(user_ct) user_ct,\n" +
            "  sum(if(review_start=5,dws_interaction_review_window.user_ct,0))/sum(dws_interaction_review_window.user_ct) five_rate\n" +
            "from dws_interaction_review_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by course_id,course_name;")
    List<InteractionReview> selectReview(Integer date);

}
